TmrChess Control Help

Contents

Overview

Properties

Methods

Events

About the Author


Overview

TmrChess Control is a chess board that is ready to use in any chess game, the control was build totally using Microsoft Visual Basic 5.0 .

This control doesn’t make the programming of the chess game for you, however it makes it more easier, using TmrChess control you won’t bother your self of how to draw the board, where is white, where is black.

The control comes with a built in chess set, you needn’t draw any piece, and they are ready to use with just one line of code.

To begin a new game you just use a method, and the board is ready, each piece is in its place, to clear the board, another method is used, so the board is now empty, you can put any piece anywhere, and know which piece is in a certain square.

The author of this ActiveX control is Tamer Abdel-Baset .

This Control is FREEWARE only for trial and home users , if you want to use it commercially , please Email me at: www.tmrbaset@hotmail.com

If you want to distribute this control , you are welcome , but DO NOT Change any file with in this package and distribute it as is .

Please visit me at : www.geocities.com/SiliconValley/Sector/7445

Please report any problems or bugs to the above Email .

Contents


Properties

TmrChess control has many properties similar to any ActiveX control. The only property that needs explaining is the piece property.

The piece property is a run-time property that can be used to put a specified piece in a square , you can also know what piece in the specified square by this property .

Syntax

Object.Piece(col As Integer, row As Integer) [= PieceNum]

Object is the control that the property will be applied on (TmrChess control)

Col & row are integers that specefy the column and row numbers ( hence the square needed) where a piece needed to be put in.

PieceNum is the number of the piece as follows:

Variable name	Equivalent integer	Picture	Piece name
None	1		Empty square
Bpawn	2		Black pawn
Brook	3		Black rook
Bknight	4		Black knight
Bbishop	5		Black bishop
Bqueen	6		Black queen
Bking	7		Black king
Wpawn	8		White pawn
Wrook	9		White rook
Wknight	10		White knight
Wbishop	11		Whit bishop
Wqueen	12		White queen
Wking	13		White king

Examples :

Tmrchess1.piece(2,4)=wbishop

This examples puts a white pishop in the square in column(2) and row(4) .

PieceNum= tmrchess1.piece(2,4)

This example gets the number of the piece in column(2) and row(4) .

NOTE:

You can use the piece property to move a piece that you can set a square to hold a piece then make the square that ware holding that piece to be none

Example :

If you have a white rook in the square (2,7) and need to move it to square (2,4) then write the following code:

Tmrchess1.piece(2,7)=none

Tmrchess1.piece(2,4)=wrook

Contents


Methods

TmrChess control has some methods similar to those in all ActiveX controls like (Drag , move , etc…) but there is two new methods :

NewGame:

This method puts the pieces of the chess in the initial position of a new game so you don’t bother your self putting them manually

Syntax:

Object.newgame .

Clear :

The clear method clears the board and removes all the pieces from the board .

Syntax:

Object.clear .

Contents


Events

TmrChess control has all the events of the common ActiveX control but some parameters are added to the following events :

Click : Event Click(col As Integer, row As Integer)

Dblclick : Event DblClick(col As Integer, row As Integer)

MouseMove : Event MouseMove(col As Integer, row As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

MouseDown : Event MouseDown(col As Integer, row As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

MouseUP : Event MouseUp(col As Integer, row As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

There are two new parameters in each of the above events : col & row , they specify the column and the row of the square where the event happens so you can control your program precisely .

Contents


About the author

Name : : Tamer Abdel-Baset Abdel-Aziz Mohammed Salem .

Email : http://www.tmrbaset@hotmail.com .

I study : Communications and Electronic Engineering in the Faculty of Engineering , Ain Shams University , Cairo , Egypt .

I have been programming with Visual Basic since 4 years . I began withVB 3.0 till I reached VB 5.0 , Programming is a hobby to me so I make it for my own pleasure , I made Some other programs that you may find in my home page .

Please visit me at : www.geocities.com/SiliconValley/Sector/7445

I wish you Email me with your ideas and opinion about my programs .